package MyJava.Test;

public class Computer {
    public static double jiSuan(int n) {
        if (n < 1) {
        //    throw Exception("n must be > 1");
            return 0d;
        }

        if (n == 1) {
            return 2.0d/1;
        }

        int a = 1,b =1;
        int c = 1,d = 0;
        int currentX = 2;
        int previousX = 0;
        double ret = 0;
        
        for (int i = 1;i < n; i++) {
            int tmp = a;
            a = a + b;
            b = tmp;

            tmp = c;
            c = c + d;
            d = tmp;
        }
        System.out.println("a = " + a + ",b = " + c);
        ret = ((double) a) / c;
        return ret;
    }

    public static void main(String [] args) {
        for (int i = 2;i < 11 ; i++) {
            Computer.jiSuan(i);
        }
    }
}
